package edu.sjsu.cs.queryopt.dbms.dao;

import java.util.ArrayList;
/**
 *  This part is for this indexing and printing list 
 * **/
public class IndexList {
	public ArrayList<Index> list;

	public IndexList() {
		list = new ArrayList<Index>();
	}

	/**
	 * Prints this index list.
	 */
	public void printIndexList() {
		System.out.println("\n\nPrinting Index List...");

		int maxCols = 0;
		for (Index index : list) {
			if (maxCols < index.definitions.size())
				maxCols = index.definitions.size();
		}

		System.out.print("\nIndex Name   ");
		for (int i = 0; i < maxCols; i++)
			System.out.print("COL" + i + "  ");
		
		System.out.print("\n-------------");
		for (int i = 0; i < maxCols; i++)
			System.out.print("------");
//		System.out.println("List "  + list.get(0).definitions);
//		System.out.println("List "  + list.get(1).definitions);
//		System.out.println("List "  + list.get(2).definitions);
		for (Index index : list) {
			System.out.format("\n%-13s", index.name);

			for (String definition : index.definitions) {
				System.out.format("%-6s", definition);
			}
		}
	}
}
